package laMalinche.AnnotatedRules;

import laMalinche.rete.rule.*;

import java.util.List;
import java.util.ArrayList;

import org.jetbrains.annotations.NotNull;

/**
 * Created by IntelliJ IDEA.
 * User: ranran
 * Date: Aug 14, 2009
 * Time: 6:34:14 AM
 * adapter from AnnotatedMethod To ProductionRule
 */
public class AnnotatedMethodToProductionRule<S> extends BasicProductionRule implements InScopeOf<S> {
    private S scope;
    private final List<Condition> conditions = new ArrayList<Condition>();
    private AnnotateMethod annotateMethod;

    public AnnotatedMethodToProductionRule(AnnotateMethod annotateMethod) {
        this.annotateMethod = annotateMethod;
        this.setAction(annotateMethod.getAction());
    }

    public S getScope() {
        return scope;
    }

    public void setScope(S scope) {
        this.scope = scope;
    }


    public int getPriority() {
        return 0;
    }

    public BusinessRuleType getProductionRuleType() {
        return annotateMethod.getBusinessRuleType();
    }

    public List<Condition> getConditions() {
        return conditions;
    }
}
